package com.wmlive.hhvideo.heihei.recordvideo.widget;

import android.content.Context;
import android.graphics.Rect;
import android.support.v7.widget.AppCompatEditText;
import android.util.AttributeSet;

/**
 * EditText获取焦点时,hint值消失
 */
public class EditTextEx extends AppCompatEditText {

    private String hint;

    public EditTextEx(Context context) {
        this(context, null);
    }

    public EditTextEx(Context context, AttributeSet attrs) {
        super(context, attrs);
        hint = getHint().toString();
    }

    @Override
    protected void onFocusChanged(boolean focused, int direction,
                                  Rect previouslyFocusedRect) {
        if (focused) {
            setHint("");
        } else {
            setHint(hint);
        }
        super.onFocusChanged(focused, direction, previouslyFocusedRect);
    }
}
